package ControlLayer;
import java.util.ArrayList;
import ModelLayer.*;

/**
 * This is a controller class for an Order list
 * 
 * @author (dmab0913 Gruppe4) 
 * @version (a version number or a date)
 */
public class OrderCtr
{
    private OrderContainer oCon;
    private Order myOrder;

    /**
     * Constructor for objects of class OrderCtr
     */
    public OrderCtr()
    {
        oCon = oCon.getInstance();
    }

    /**
     * controller deletes an object in the container class for Order
     */
    public Order findOrder(long orderNumber)
    {
        return oCon.findOrder(orderNumber);
    }

    /**
     * controller creates an order and puts in the container
     */
    public void createOrder(long orderNumber,int date , int deliveryDate, int paymentDeadline, String status)
    {
        myOrder = new Order(orderNumber, date, deliveryDate, paymentDeadline, status);
        oCon.addOrder(myOrder);
    }

    /**
     * controller updates an order
     */
    public void updateOrder(long orderNumber, int date, int deliveryDate, int paymentDeadline, String status)
    {
        oCon.updateOrder(orderNumber, date, deliveryDate, paymentDeadline, status);
    }

    public void setDate(long orderNumber, int date)
    {
        oCon.findOrder(orderNumber).setDate(date);
    }

    public void setDeliveryDate(long orderNumber, int deliveryDate)
    {
        oCon.findOrder(orderNumber).setDeliveryDate(deliveryDate);
    }

    public void setPaymentDeadline(long orderNumber, int paymentDeadline)
    {
        oCon.findOrder(orderNumber).setPaymentDeadline(paymentDeadline);
    }

    public void setStatus(long orderNumber, String status)
    {
        oCon.findOrder(orderNumber).setStatus(status);
    }
}
